package com.es.hr.shop;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

import com.es.business.area.AreaBean;
import com.es.business.area.AreaBiz;
import com.es.business.city.CityBean;
import com.es.business.city.CityBiz;
import com.es.business.citys.CitysBean;
import com.es.business.citys.CitysBiz;
import com.es.business.province.ProvinceBean;
import com.es.business.province.ProvinceBiz;
import com.es.common.CommonBiz;
import com.es.hr.emp.EmpInfoBean;
import com.es.util.page.PageBean;
import com.opensymphony.webwork.interceptor.ServletRequestAware;
import com.opensymphony.xwork.ActionSupport;

public class ShopDetailDoAction extends ActionSupport
implements ServletRequestAware{
	 HttpServletRequest request;

	public void setServletRequest(HttpServletRequest paramHttpServletRequest) {
		// TODO Auto-generated method stub
		this.request = paramHttpServletRequest;
	}
	
	public String execute() throws Exception{
		String result = "";
		ShopBiz shopBiz = new ShopBiz();
		
		String shopId = this.request.getParameter("shop_id");
		
		ShopBean res = shopBiz.getShopById(shopId);
		
		request.setAttribute("shopBean", res);
		request.setAttribute("cityLevel", new CityBiz().getCityByCode(res.getShop_city_code()).getCityLevel());
		result = "success";
		return result;
	}
	
	public ShopBean getShopBBean(HttpServletRequest request) throws SecurityException, ClassNotFoundException, IllegalArgumentException, IllegalAccessException{
		Field[] fds = Class.forName("com.es.hr.shop.ShopBean").getDeclaredFields();   
		ShopBean bean = new ShopBean();
		 
		  for(int i=0;i<fds.length;i++)   
		  {   
			  String d= fds[i].getName();
			  fds[i].set(bean, request.getParameter(d));
		  }
		  return bean;
	}
	

}
